﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Reflection;
using System.IO;

/// <summary>
/// Summary description for resource
/// </summary>
public class resource
{
    /// <summary>
    /// 读取嵌入资源的文本内容
    /// </summary>
    /// <param name="fileWholeName">包含命名空间的嵌入资源文件名路径</param>
    /// <returns>文件中的文本内容</returns>
    public static string ReadFileFromEmbedded(string fileWholeName)
    {
        string result = string.Empty;

        Assembly assembly = Assembly.GetEntryAssembly();
        using (TextReader reader = new StreamReader(assembly.GetManifestResourceStream(fileWholeName)))
        {
            result = reader.ReadToEnd();
        }

        return result;
    }
}